Skip to content

feat(vibenet): show gas token fee on explorer tx detail - #108

Merged
montycheese merged 3 commits into
mainfrom
feat/explorer-gas-token-fee
Aug 28, 2026
Merged

feat(vibenet): show gas token fee on explorer tx detail#108
montycheese merged 3 commits into
mainfrom
feat/explorer-gas-token-fee

Conversation

@montycheese

@montycheese montycheese commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When the b20 demo pays gas in a stablecoin, the fee is paid by transferring the token to the AA payer as phase 0 of the account-abstraction batch rather than through any dedicated receipt field — so the explorer's tx detail page only ever showed the ETH-denominated gas fee, never the token amount actually paid.
  • Added findGasTokenFee in app/vibenet/library/explorer.ts, which detects that phase-0 pattern (a lone transfer(payer, amount) call) and returns the token contract + raw amount.
  • Added app/vibenet/library/token.ts to resolve the token's symbol()/decimals() on chain (the receipt has no metadata for an arbitrary user-deployed b20 token), so the row reads e.g. 0.1 RWRD instead of raw units.
  • Wired into the tx detail page as a "Gas token fee" row: falls back to raw units + a link to the token contract while the symbol lookup is in flight or fails.
  • When gas was paid in a token, the ETH fee row is relabeled "Network cost" and dimmed with "(paid by payer)" instead of "Fee" — it's not what the user paid, but it's still useful for debugging whether the payer's flat token fee actually covers what it spends in ETH. Gas limit/used/effective gas price are left as-is (they describe network execution, not what the user paid).

Test plan

  • npx tsc --noEmit — clean
  • npx vitest run app/vibenet/library/explorer.test.ts — 29/29 passing (3 new cases for findGasTokenFee: happy path, no-payer/no-aa, false-positive guards)
  • npx eslint on changed files — no new warnings/errors beyond pre-existing ones in this file

Before

Screenshot 2026-08-28 at 10 35 34 AM

After
Screenshot 2026-08-28 at 10 50 13 AM

The b20 demo pays gas by transferring the stablecoin fee to the AA
payer as phase 0 of the batch, rather than through any dedicated
receipt field, so the tx detail page only ever showed the ETH gas
fee even when a token was used to pay it. Detect the phase-0
transfer(payer, amount) pattern and render it as a "Gas token fee"
row alongside the existing ETH gas rows.
@cb-heimdall

cb-heimdall commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
omni-ui Ready Ready Preview Aug 28, 2026 2:43pm

Request Review

Resolve the paid token's symbol/decimals via an on-chain read (the
receipt has no metadata for it) and show a proper amount + symbol
instead of raw units. When gas was paid in a token, the ETH "Fee"
row is redundant with what the payer actually covered, so hide it
in that case.
Fully hiding the ETH fee when gas was paid in a token loses the one
number that shows whether the payer's flat token fee actually covers
what it spends in ETH. Relabel it "Network cost (paid by payer)"
instead of dropping it, so it reads as debugging info rather than
what the user paid.
@montycheese
montycheese added this pull request to the merge queue Aug 28, 2026
Merged via the queue into main with commit a764a7a Aug 28, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants